/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mz2d.engine;

import mz2d.render.MZ2DApplet;
import mz2d.cache.ResourceManager;
import mz2d.render.Projector;
import mz2d.render.ProjectorException;

/**
 *
 * @author Laptop
 */
public class MZ2D extends MZ2DApplet {

    /**
     * 
     */
    private Projector projector;
    /**
     *
     */
    private ResourceManager resourceManager;

    public MZ2D() {
        projector = new Projector(this);
        resourceManager = new ResourceManager();
    }

    /**
     * 
     * @return
     */
    public Projector getProjector() {
        return projector;
    }

    /**
     * 
     * @return
     */
    public ResourceManager getResourceManager() {
        return resourceManager;
    }

    /**
     * 
     * @param width
     * @param height
     */
    public void createWindow(int width, int height) {
        createFrame(width, height);
    }

    /*********************
     * Inerhited methods *
     *********************/
    /**
     * 
     */
    @Override
    public void gameRender() {
        try {
            projector.renderFrame();
            projector.renderEntities();
            projector.project();
        } catch (ProjectorException pe) {
            pe.printStackTrace();
            System.exit(1);
        }
    }
}
